module lcdlab1(
  input clk,			//	50 MHz clock
  input CC,
  input rst,
  input [3:0] inLcdA,
  input [3:0] inLcdB,
  input [3:0] inLcdC,
  input [3:0] inLcdD,
  input [3:0] inLcdE,
  input [3:0] inLcdF,
  input [3:0] inLcdG,
  input [3:0] inLcdH,
  input [3:0] inLcdI,
  input [3:0] inLcdJ,
  input [3:0] inLcdK,
  input [3:0] inLcdL,
  input [3:0] inLcdM,
  input [3:0] inLcdN,  
  input [3:0] inLcdO,
  input [3:0] inLcdP,
  
//	LCD Module 16X2
  output LCD_ON,	// LCD Power ON/OFF
  output LCD_BLON,	// LCD Back Light ON/OFF
  output LCD_RW,	// LCD Read/Write Select, 0 = Write, 1 = Read
  output LCD_EN,	// LCD Enable
  output LCD_RS,	// LCD Command/Data Select, 0 = Command, 1 = Data
  inout [7:0] LCD_DATA	// LCD Data bus 8 bits
);

 reg [3:0] outLcdA;
 reg [3:0] outLcdB;
 reg [3:0] outLcdC;
 reg [3:0] outLcdD;
 reg [3:0] outLcdE;
 reg [3:0] outLcdF;
 reg [3:0] outLcdG;
 reg [3:0] outLcdH;
 reg [3:0] outLcdI;
 reg [3:0] outLcdJ;
 reg [3:0] outLcdK;
 reg [3:0] outLcdL;
 reg [3:0] outLcdM;
 reg [3:0] outLcdN;
 reg [3:0] outLcdO;
 reg [3:0] outLcdP;
 
// reset delay gives some time for peripherals to initialize
wire DLY_RST;
Reset_Delay r0(	.iCLK(clk),.oRESET(DLY_RST) );


// turn LCD ON
assign	LCD_ON	=	1'b1;
assign	LCD_BLON	=	1'b1;

always @ (posedge clk or negedge rst)
begin
outLcdA = inLcdA;
outLcdB = inLcdB;
outLcdC = inLcdC;
outLcdD = inLcdD;
outLcdE = inLcdE;
outLcdF = inLcdF;
outLcdG = inLcdG;
outLcdH = inLcdH;
outLcdI = inLcdI;
outLcdJ = inLcdJ;
outLcdK = inLcdK;
outLcdL = inLcdL;
outLcdM = inLcdM;
outLcdN = inLcdN;
outLcdO = inLcdO;
outLcdP = inLcdP;
end


//u1
LCD_TEST (
// Host Side
   .iCLK(clk),
   .iRST_N(DLY_RST),
// LCD Side
   .LCD_DATA(LCD_DATA),
   .LCD_RW(LCD_RW),
   .LCD_EN(LCD_EN),
   .LCD_RS(LCD_RS),
	.inLcdA(outLcdA),
	.inLcdB(outLcdB),
	.inLcdC(outLcdC),
	.inLcdD(outLcdD),
	.inLcdE(outLcdE),
	.inLcdF(outLcdF),
	.inLcdG(outLcdG),
	.inLcdH(outLcdH),
	.inLcdI(outLcdI),
	.inLcdJ(outLcdJ),
	.inLcdK(outLcdJ),
	.inLcdL(outLcdL),
	.inLcdM(outLcdM),
	.inLcdN(outLcdN),
	.inLcdO(outLcdO),
	.inLcdP(outLcdP)
);

endmodule